// import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import HomeView from '../views/HomeView.vue'
// import { defineConfig } from 'vite';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/webAI'
  },
  {
    path: '/webAI',
    name: 'webAI',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]
const router = createRouter({
  history: createWebHistory(),
  // history: createWebHashHistory(),
  routes,
});
console.log(import.meta.env.VITE_APP_TITLE,'-------------------------------');
export default router;

// import { createRouter, createWebHistory } from 'vue-router'

// const router = createRouter({
//   // history:hash/history
//   // history: createWebHashHistory(),
//   history: createWebHistory(import.meta.env.VITE_NAME as string),
//   routes: [
//     {
//       path: '/',
//       redirect: '/index'
//     },

//     {
//       path: '/index',
//       name: 'index',
//       component: () => import('../views/index.vue'),
//     },
//     {
//       path: '/bottom',
//       name: 'bottom',
//       component: () => import('../views/bottom/index.vue'),
//     },
//   ]
// })
// // 导航守卫
// // 参数: to(跳转到的位置)/from(从哪里跳转过来)
// // 返回值: 返回值决定导航的路径(不返回或者返回undefined, 默认跳转)
// // 举个栗子: / => /main
// // to: /main from: / 返回值: /abc
// router.beforeEach((to, from, next) => {

//   next()
//   // 如果进入到main路由下默认进入获取到的第一个子路由下并渲染
// })

// export default router
